//
//  CPAudioPlayerView.h
//  GHTestWebViewDemo
//
//  Created by collegepre on 16/12/2.
//  Copyright © 2016年 张冠华. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CPAudioTools.h"
#import "CPAudioPlayer.h"

// 监听关闭按钮
typedef void(^CPAudioPlayerCloseBlock)();

// 播放完成结束回调Block
typedef void(^CPAudioPlayerComplitionBlock)();

// 监听进度播放
typedef void(^CPAudioPlayerProgressBlock)(double progress);

// 监听进度播放
typedef void(^CPAudioPlayerDragProgressBlock)(double progress,BOOL playState);

// 监听开始暂停
typedef void(^CPAudioPlayerPlayBlock)(NSTimeInterval currentTime,BOOL isStart);

@interface CPAudioPlayerView : UIView

+ (instancetype)audioPlayerView;
- (instancetype)audioPlayerViewWithSuperView:(UIView *)superView;

- (void)startPlayWithAudioPath:(NSString *)path complition:(CPAudioPlayerComplitionBlock)complition;

- (void)puasePlayAuido;

- (void)stopPlayAudio;

@property (nonatomic, strong) UIWebView *webView;

@property (nonatomic, copy) CPAudioPlayerCloseBlock closeBlock;

@property (nonatomic, copy) CPAudioPlayerProgressBlock progressBlock;

@property (nonatomic, copy) CPAudioPlayerPlayBlock playBlock;

@property (nonatomic, copy) CPAudioPlayerComplitionBlock complitionBlock;

@property (copy,nonatomic) CPAudioPlayerDragProgressBlock dragProgressBlock;

@property (nonatomic, assign,readonly) double  audioPlayProgress;



//播放按钮
@property (weak, nonatomic) IBOutlet UIButton *playBtn;

// 播放进度条控制
@property (weak, nonatomic) IBOutlet UISlider *progressSlider;

// 关闭按钮
@property (weak, nonatomic) IBOutlet UIButton *closeBtn;

// 播放音频的路径
@property (copy,nonatomic) NSString *audioPath;

- (void)setAudioPlayProgress:(double)progress audioPlayState:(BOOL)isPlay;
@end
